Skip Headers

Oracle® Database Backup and Recovery Basics 10g Release 2 (10.2) Part Number B14192-03 |
Home | Book List | Contents | Index | Master Index | Feedback

Previous | Next
| View PDF

# 8.2 Using CROSSCHECK to Update the RMAN Repository

To ensure that data about backups in the recovery catalog or control file is synchronized with corresponding data on disk or in the media management catalog, perform a crosscheck. The `CROSSCHECK` command operates only on files that are recorded in the recovery catalog or the control file.

This section contains these topics:

- About RMAN Crosschecks

- Basic Use of CROSSCHECK with Backup Sets and Image Copies

- Crosschecking Specific Backup Sets and Copies

- Crosschecking Backups of Specific Database Files

## 8.2.1 About RMAN Crosschecks

Crosschecks update outdated RMAN repository information about backups whose repository records do not match their physical status. For example, if a user removes archived logs from disk with an operating system command, the repository still indicates that the logs are on disk, when in fact they are not.

If the backup is on disk, then the `CROSSCHECK` command determines whether the header of the file is valid. If the backup is on tape, then the command simply checks that the backup exists. The possible status values for backups are `AVAILABLE`, `UNAVAILABLE`, and `EXPIRED`.

You can view the status of backups using the RMAN `LIST` command, or by querying`V$BACKUP_FILES` or many of the recovery catalog views such as `RC_DATAFILE_COPY` or `RC_ARCHIVED_LOG`. Running a crosscheck updaets the RMAN repository so that all of these methods provide accurate information. For each backup in the RMAN repository, if the backup is no longer available, then RMAN marks it as `EXPIRED`. If it was `EXPIRED` and is now available, then RMAN marks it `AVAILABLE`.

Note: The `CROSSCHECK` command does not delete operating system files, and it does not remove RMAN repository records of backups that are not available at the time of the crosscheck. It only updates the repository records with the status of the backups. Use the `DELETE` command to remove records of expired backups from the RMAN repository.

: "Deleting Backups" to learn how to delete unwanted backups and update repository records Oracle Database Backup and Recovery Reference for `CROSSCHECK` command syntax and a description of the repository status values

## 8.2.2 Basic Use of CROSSCHECK with Backup Sets and Image Copies

After connecting to the target database and recovery catalog (if you use one), run `CROSSCHECK` commands as needed to verify the status and availability of backups known to RMAN.

If you have channnels configured for your tape or other media manager, you can crosscheck all backups on all media with `CROSSCHECK` `BACKUP` as shown in this example:

    CROSSCHECK BACKUP;

If you do not have configured channels for your tape backups, you can allocate a maintenance channel in a RUN block before running `CROSSCHECK` as in this example:

    RUN {
         ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt;
         CROSSCHECK BACKUP;
    }

This example shows how to crosscheck disk image copies only:

    CROSSCHECK COPY;    # crosschecks only disk copies of
                        # database files

This example shows how to crosscheck backup sets only:

    CROSSCHECK BACKUPSET;    # crosschecks backupsets on disk and SBT

## 8.2.3 Crosschecking Specific Backup Sets and Copies

You can use the `LIST` command to report your backups and then use the `CROSSCHECK` command to check that specific backups described in the `LIST` output still exist. The `DELETE` `EXPIRED` command deletes repository records for backups that fail the crosscheck.

To crosscheck specified backups:

1. Identify the desired backups that you want to check by issuing a `LIST` command. For example, issue:

       LIST BACKUP;  # lists all backup sets, proxy copies, and image copies

2. Check whether the specified backups still exist. For example, enter:

       CROSSCHECK BACKUP;  # checks backup sets, proxy copies, and image copies
       CROSSCHECK COPY OF DATABASE;
       CROSSCHECK BACKUPSET 1338, 1339, 1340;
       CROSSCHECK BACKUPPIECE TAG = 'nightly_backup';
       CROSSCHECK CONTROLFILECOPY '/tmp/control01.ctl';
       CROSSCHECK DATAFILECOPY 113, 114, 115;
       CROSSCHECK PROXY 789;

## 8.2.4 Crosschecking Backups of Specific Database Files

You can use options of the `CROSSCHECK` command to check only backups of a specific database, tablespace, datafile, control file, or archived redo log. For example:

    CROSSCHECK BACKUP OF DATAFILE "?/oradata/trgt/system01.dbf"
      COMPLETED AFTER 'SYSDATE-14';
    CROSSCHECK BACKUP OF ARCHIVELOG ALL SPFILE;

You can check for backups of archived redo logs and SPFILE using this command:

    CROSSCHECK BACKUP OF ARCHIVELOG ALL SPFILE;

See Also: Oracle Database Backup and Recovery Reference for more details on using `CROSSCHECK` to check backups of specific database files

## 8.2.5 Limiting RMAN CROSSCHECK to a Backups Since a Specific Time

You can add a `COMPLETED` `AFTER` clause to a `CROSSCHECK` command to restrict the checking to backups created after a specified point in time. For example, this command checks for backups of a datafile created in the last week:

    CROSSCHECK BACKUP OF DATAFILE 4
      COMPLETED AFTER 'SYSDATE-14';